package com.zyz.I_多线程.Lambada表达式;

/**
 * @author: vick
 * @Date: 2025/3/21
 * @Description:
 * @version: 1.0
 */
public class TestRunnable {
    public static void main(String[] args) {
        Runnable runnable = () -> {
            for (int i = 0; i < 10; i++) {
                System.out.println(Thread.currentThread().getName() + "正在运行" + i);
            }
        };

        Thread thread = new Thread(runnable, "子线程1");
        thread.start();


        //在主线程中，执行for循环
        for (int i = 0; i < 10; i++) {
            System.out.println("main主线程：" + i);
        }
    }
}
